#include <iostream>
#include <queue>
using namespace std;
int M, N;
bool st[1010];
queue<int> q;
int main()
{
	cin >> M >> N;
	int a[1010];
	for (int i = 0;i < N;i++)
	{
		cin >> a[i];
	}
	int count = 0;
	for (int i = 0;i < N;i++)
	{
		if (q.size() < M && !st[a[i]])
		{
			q.push(a[i]);
			st[a[i]] = true;
			count++;
		}
		if (q.size() == M && !st[a[i]])
		{
			int t;
			t = q.front();
			st[t] = false;
			q.pop();
			q.push(a[i]);
			st[a[i]] = true;
			count++;
		}
		
	}
	cout << count;
	return 0;
}